/*   1:    */ package com.rinsi.util;
/*   2:    */ 
/*   3:    */ import org.springframework.beans.BeansException;
/*   4:    */ import org.springframework.beans.factory.NoSuchBeanDefinitionException;
/*   5:    */ import org.springframework.context.ApplicationContext;
/*   6:    */ import org.springframework.context.ApplicationContextAware;
/*   7:    */ import org.springframework.stereotype.Component;
/*   8:    */ 
/*   9:    */ @Component
/*  10:    */ public class SpringContextUtil implements ApplicationContextAware
/*  12:    */ {
/*  13:    */   private static ApplicationContext applicationContext;
/*  14:    */   
/*  15:    */   public void setApplicationContext(ApplicationContext applicationContext) throws BeansException
/*  17:    */   {
/*  18: 30 */     SpringContextUtil.applicationContext = applicationContext;
/*  19:    */   }
/*  20:    */   
/*  21:    */   public static ApplicationContext getApplicationContext()
/*  22:    */   {
/*  23: 38 */     return applicationContext;
/*  24:    */   }
/*  25:    */   
/*  26:    */   public static <T> T getBean(String name)
/*  27:    */     throws BeansException
/*  28:    */   {
/*  29: 51 */     return (T) applicationContext.getBean(name);
/*  30:    */   }
/*  31:    */   
/*  32:    */   public static <T> T getBean(Class<T> clz)
/*  33:    */     throws BeansException
/*  34:    */   {
/*  35: 63 */     T result = applicationContext.getBean(clz);
/*  36:    */     
/*  37: 65 */     return result;
/*  38:    */   }
/*  39:    */   
/*  40:    */   public static boolean containsBean(String name)
/*  41:    */   {
/*  42: 76 */     return applicationContext.containsBean(name);
/*  43:    */   }
/*  44:    */   
/*  45:    */   public static boolean isSingleton(String name)
/*  46:    */     throws NoSuchBeanDefinitionException
/*  47:    */   {
/*  48: 88 */     return applicationContext.isSingleton(name);
/*  49:    */   }
/*  50:    */   
/*  51:    */   public static Class<?> getType(String name)
/*  52:    */     throws NoSuchBeanDefinitionException
/*  53:    */   {
/*  54: 98 */     return applicationContext.getType(name);
/*  55:    */   }
/*  56:    */   
/*  57:    */   public static String[] getAliases(String name)
/*  58:    */     throws NoSuchBeanDefinitionException
/*  59:    */   {
/*  60:110 */     return applicationContext.getAliases(name);
/*  61:    */   }
/*  62:    */ }


/* Location:           D:\Users\Desktop\shanxi\项目\sxazmis\WEB-INF\classes\
 * Qualified Name:     com.rinsi.util.SpringContextUtil
 * JD-Core Version:    0.7.0.1
 */